//
//  KLManagePayPwdTableViewController.m
//  KISSLOCK
//
//  Created by 陈宾鹏 on 16/8/14.
//  Copyright © 2016年 陈宾鹏. All rights reserved.
//

#import "KLManagePayPwdTableViewController.h"
#import "KLHelp.h"
#import "Masonry.h"
#import "HemaConst.h"
#import "JRToast.h"
#import "KLChangePayPwdViewController.h"
#import "KLRechargepayPwdViewController.h"

@interface KLManagePayPwdTableViewController ()

@end

@implementation KLManagePayPwdTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = RGB_UI_COLOR(242, 242, 242);
    self.tableView.tableFooterView = [[UIView alloc]init];
    [self naveSet];
}

#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"managePayPwd"];
    if(!cell){
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"managePayPwd"];
    }
    if(indexPath.row == 0){
        cell.textLabel.text = @"修改支付密码";
    }else if (indexPath.row == 1){
        cell.textLabel.text = @"忘记支付密码";
    }
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if(indexPath.row == 0){
        //获取Main.storyboard
        UIStoryboard *mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        //获取Main.storyboard中的第2个视图
        KLChangePayPwdViewController *changePayPwd = [mainStory instantiateViewControllerWithIdentifier:@"changePayPwd"];
        [self.navigationController pushViewController:changePayPwd animated:YES];
    }else if(indexPath.row == 1){
        KLRechargepayPwdViewController *rechargePayPwdVC = [[KLRechargepayPwdViewController alloc]init];
        [self.navigationController pushViewController:rechargePayPwdVC animated:YES];
    }
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 8.0f;
}

#pragma mark - 界面设置
//初始化导航栏
-(void)naveSet{
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBarHidden = NO;
    self.title = @"管理支付密码";
    
    [KLHelp navSet:self doBackHandeler:^(UIButton *backButton) {
        [backButton addTarget:self action:@selector(doBack:) forControlEvents:UIControlEventTouchUpInside];
    }];
}-(void)doBack:(id)sender{
    [self.navigationController popViewControllerAnimated:YES];
}

@end
